package org.springblade.common.mq;

import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.github.thierrysquirrel.annotation.CommonMessage;
import com.github.thierrysquirrel.annotation.RocketMessage;
import com.github.thierrysquirrel.annotation.StartDeliverTime;
import com.github.thierrysquirrel.core.producer.MessageSendType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * @Author ysq
 * @Date 2025/07/17
 * @Description 救援延迟消息
 */
@Slf4j
@Component
@RocketMessage(groupID = "GID_RESCUE_DELAY")
public class RescueDelaySend {

	@CommonMessage(topic = "rescue_delay", messageSendType = MessageSendType.SEND_ASYNC)
	public String sendDelayMsg(@StartDeliverTime long startDeliverTime, String message) {
		log.info("===============救援延迟消息====================", System.currentTimeMillis());
		JSONObject jsonObject = JSONObject.parseObject(message);
		log.info("发送时间:[{}],延迟时间:[{}], 发送内容:[救援延迟消息:{}]", LocalDateTime.now(), DateUtil.format(new Date(startDeliverTime), "yyyy-MM-dd HH:mm:ss"), JSONObject.toJSONString(jsonObject));
		return message;
	}
}
